# -*- coding: utf-8 -*-
# ----------------------------
# @Time    : 2021/7/4 3:29 下午
# @Author  : changqingai
# @FileName: 02-reduce.py
# ----------------------------

from pyspark import SparkContext

if __name__ == "__main__":
    sc = SparkContext(master='local[2]', appName="reduce")
    x = sc.parallelize([("spark", 1), ("hadoop", 4)])
    y = sc.parallelize([("spark", 2), ("hadoop", 2), ("pyspark", 2)])
    joined = x.join(y)
    res = joined.collect()
    print("res", res)
